package com.fz.Dao;

import com.fz.entity.Book;
import com.fz.mapper.BookMapper;
import lombok.Data;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created by webrx on 2017-09-12.
 */
/*@Service*/
@Data
public class BookDAO implements BookMapper{
    /*@Autowired */  //加@Autowired就是自动分配的意思,这里我已经在applicationContext.xml中配置过了
    private BookMapper daoo;  //写这一步就省去了实例化

    private SqlSession session;

    public void mysave(String name){

    }
    public void jdbc(){
        System.out.println(this.session.getConnection());
    }
    public Book queryById(int id){
        return daoo.queryById(id);
    }

    public List<Book> queryAll(){
        return daoo.queryAll();
    }

    public int save(Book book) {
        return daoo.save(book);
    }

    public int save1(String name, double price, Date bdate) {
        return 0;
    }

    public List<Map<String, Object>> query() {
        return null;
    }

    public int deleteById(int id) {
        return daoo.deleteById(id);
    }
}
